<?php
session_start();
if(! isset($_SESSION['username'])) {
    header('Location:index.html');
}

include('conn.php');

$sql = "select * from xiaoxi  where flag=0 and username='{$_SESSION['username']}' order by id desc";
         
$arr = [];
    foreach ( $conn->query($sql) as $row) {
     $arr[] = $row;
}

$data = [
    'code' => 200,
    'message'=> '',
    'data' => $arr,
];

echo json_encode($data);

?>
